home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C++ / Applications / Nuntius 1.2 / src / Nuntius / UNntp.h < prev    next >
Encoding:
Text File  |  1994-03-16  |  2.1 KB  |  92 lines  |  [TEXT/MPS ]

  1. // Copyright © 1992 Peter Speck, speck@dat.ruc.dk. All rights reserved.
  2. // UNntp.h
  3.  
  4. #define __UNNTP__
  5.  
  6. #ifndef __UPERIODIC__
  7. #include "UPeriodic.h"
  8. #endif
  9.  
  10. #ifndef __UPTROBJECT__
  11. #include "UPtrObject.h"
  12. #endif
  13.  
  14. class PNntp : public PPtrObject
  15. {
  16.     public:
  17.         // NOTE: All returned handles are owned by the caller
  18.         // The handles are null terminated
  19.  
  20.         virtual Handle GetListOfAllGroups() = 0;
  21.         virtual Handle GetListOfNewGroups(unsigned long fromDate) = 0;
  22.         
  23.         virtual Handle GetListOfGroupDesciptions() = 0;
  24.         
  25.         virtual void SetGroup(const CStr255 &dotName, Boolean forceUpdate = false);
  26.  
  27.         virtual void GetGroupInfo(long &firstArticleID, long &lastArticleID);
  28.         
  29.         virtual Handle GetHeaderList(const char *headerName, long firstArticleID, long lastArticleID) = 0;
  30.         
  31.         virtual Handle GetArticle(long articleID) = 0;
  32.         
  33.         virtual void PostArticle(Handle h, short ackStringID) = 0;
  34.         
  35.         virtual Boolean IsPostingAllowed() = 0; // general, not for the specific group
  36.         
  37.         virtual void ExamineNewsServer() = 0;
  38.  
  39.         PNntp();
  40.         virtual void INntp();
  41.         virtual ~PNntp();
  42.     protected:
  43.         CStr255 fCurrentDotName;
  44.         long fFirstArticleID, fLastArticleID;
  45.  
  46.         virtual void DoSetGroup(const CStr255 &name) = 0;
  47. };
  48.  
  49.  
  50. class TNntpCache : public TPeriodicAction
  51. {
  52.     public:
  53.         PNntp *GetNntp();
  54.         void ReturnNntp(PNntp *nntp); // cannot fail
  55.         void DiscardNntp(PNntp *nntp); // cannot fail
  56.         // it's allowed to return/discard nil objects
  57.         
  58.         long GetNoIdleConnections();
  59.         long GetNoActiveConnections();
  60.  
  61.         void FlushCache();
  62.         void UpdateTiming();
  63.  
  64.         TNntpCache();
  65.         pascal void Initialize();
  66.         void INntpCache();
  67.         pascal void Free();
  68.     
  69.     protected:
  70.         void DoPeriodic();
  71.         const char *GetDebugDescription();
  72.         Boolean NeedTime();
  73.         Boolean SkipFirstCheckAfterWakeUp();
  74.         
  75.     private:
  76.         TLongintList *fObjectsInUseList; // realy need TPtrList
  77.         TLongintList *fIdleObjectsList;
  78.         TLongintList *fTimeWhenCachedList;
  79.  
  80.         long CreateNewObject();
  81.         long FreeObject(long obj);
  82.  
  83.         const char *GetObjectName();
  84. };
  85.  
  86. void DoUseFakeNntp(); // sets global flag
  87. Boolean UsesFakeNntp();
  88.  
  89. void InitUNntp();
  90. void CloseDownUNntp();
  91. extern TNntpCache *gNntpCache;
  92.